package cn.iocoder.yudao.module.ride.dal.mysql.training;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ride.dal.dataobject.training.TrainingDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ride.controller.admin.training.vo.*;

/**
 * 司机培训课程 Mapper
 *
 * @author 小胡同学
 */
@Mapper
public interface TrainingMapper extends BaseMapperX<TrainingDO> {

    default PageResult<TrainingDO> selectPage(TrainingPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TrainingDO>()
                .eqIfPresent(TrainingDO::getDriverId, reqVO.getDriverId())
                .likeIfPresent(TrainingDO::getCourseName, reqVO.getCourseName())
                .betweenIfPresent(TrainingDO::getTrainingDate, reqVO.getTrainingDate())
                .betweenIfPresent(TrainingDO::getStartDate, reqVO.getStartDate())
                .betweenIfPresent(TrainingDO::getEndDate, reqVO.getEndDate())
                .eqIfPresent(TrainingDO::getDurationMinutes, reqVO.getDurationMinutes())
                .orderByDesc(TrainingDO::getId));
    }

}